﻿<%@ WebHandler Language="VB" Class="UploadHandler" %>

Imports System
Imports System.Web
Imports System.IO


Public Class UploadHandler : Implements IHttpHandler
    
    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        Dim strFileName As String = Path.GetFileName(context.Request.Files(0).FileName)
        Dim strExtension As String = Path.GetExtension(context.Request.Files(0).FileName).ToLower()
        Dim strLocation As String = context.Server.MapPath("~") & "/ItemImages/" & strFileName
        context.Request.Files(0).SaveAs(strLocation)
        
        context.Response.ContentType = "text/plain"
        context.Response.Write("Hello World")
    End Sub
 
    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property

End Class